home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sys.amiga.programmer
- Path: dd.chalmers.se!news.chalmers.se!sunic!trane.uninett.no!eunet.no!nuug!EU.net!howland.reston.ans.net!cs.utexas.edu!convex!news.duke.edu!concert!sas!mozart.unx.sas.com!walker
- From: walker@twix.unx.sas.com (Doug Walker)
- Subject: Re: PROTOTYPING
- Originator: walker@twix.unx.sas.com
- Sender: news@unx.sas.com (Noter of Newsworthy Events)
- Message-ID: <CpwJE2.9Lz@unx.sas.com>
- Date: Mon, 16 May 1994 15:37:13 GMT
- References: <2r2sbh$47n@dsm6.dsmnet.com> <2r5hfu$t61@jadzia.CSOS.ORST.EDU>
- Nntp-Posting-Host: twix.unx.sas.com
- Organization: SAS Institute Inc.
- Lines: 51
-
-
- In article <2r5hfu$t61@jadzia.CSOS.ORST.EDU>, glade@CSOS.ORST.EDU (Glade Diviney) writes:
- |> #include <stdio.h>
- |> #include <exec/types.h>
- |>
- |> void MyPrintfSub(char *format, ULONG args[])
- |> {
- |> printf(format,args[1],args[2],args[3],
- |> args[4],args[5],args[6],args[7],args[8]);
- |> }
- |>
- |> // Passes a pointer to the array of args on to MyPrintfSub().
- |> void MyPrintf(char *fmt,...)
- |> {
- |> MyPrintfSub (fmt,(ULONG *)&fmt);
- |> }
- |>
- |>
- |> void main()
- |> {
- |> MyPrintf("Testing %d %d %d!\n",1,2,3);
- |> }
-
- Please do not use this technique. It assumes you know how the
- compiler lays out parameters on the stack, which is NOT a valid
- assumption. Use the ANSI <stdarg.h> includes instead.
-
- #include <stdarg.h>
- #include <stdio.h>
-
- void MyPrintf(char *fmt, ...)
- {
- va_list arglist;
- va_start(arglist, fmt);
- vfprintf(stdout, fmt, arglist);
- va_end(arglist);
- }
-
- void main(void)
- {
- MyPrintf("Testing %d %d %d!\n",1,2,3);
- }
-
- --
- ***** / walker@unx.sas.com
- *|_o_o|\\ Doug Walker< BIX, Portal: djwalker
- *|. o.| || \ CompuServe: 71165,2274
- | o |//
- ======
- Any opinions expressed are mine, not those of SAS Institute, Inc.
-